<template>
  <div v-if="fifth[0]">
    <div class="sofa margin">
      <div class="single-sofa" :key="item.id" v-for="item in fifth[0].banners">
        <img :src="item.bannerImgSrc" alt="">
      </div>
    </div>
    <div class="sofa margin">
      <div class="single-sofa" :key="item.id" v-for="item in fifth[1].banners">
        <img :src="item.bannerImgSrc" alt="">
      </div>
    </div>
    <div class="sofa margin">
      <div class="single-sofa" :key="item.id" v-for="item in fifth[2].banners">
        <img :src="item.bannerImgSrc" alt="">
      </div>
    </div>
    <div class="gap margin">
      <img :src="fifth[3].bannerImgSrc" alt="">
    </div>
    <div class="study margin">
      <img :src="fifth[4].bannerImgSrc" alt="">
    </div>
    <div class="chairs margin">
      <div class="single-sofa" :key="item.id" v-for="item in fifth[5].banners">
        <img :src="item.bannerImgSrc" alt="">
      </div>
    </div>
    <div class="chairs margin">
      <div class="single-sofa" :key="item.id" v-for="item in fifth[6].banners">
        <img :src="item.bannerImgSrc" alt="">
      </div>
    </div>
    <div class="sofa margin">
      <div class="single-sofa" :key="item.id" v-for="item in fifth[7].banners">
        <img :src="item.bannerImgSrc" alt="">
      </div>
    </div>
    <sixdata></sixdata>
  </div>
</template>

<script>
import axios from 'axios'
import sixdata from './six'
export default {
  data () {
    return {
      fifth: []
    }
  },
  mounted () {
    window.onscroll = () => {
      if ((document.documentElement.scrollTop + document.documentElement.clientHeight) === document.documentElement.scrollHeight) {
        axios.get('/v2/page?pageId=1&tabId=1&currentPage=5&pageSize=8&_=1583393399000').then(res => {
          this.fifth = res.data.data.modules.map(item => item.moduleContent)
        })
      }
    }
  },
  destroyed () {
    window.onscroll = null
  },
  components: {
    sixdata
  }
}
</script>

<style lang="scss" scoped>
img {
  width: 100%;
}
.sofa{
  display: flex;
  background: white;
  padding: 30px 15px 10px 15px;
  justify-content: space-between;
  .single-sofa{
    width: 48%;
  }
}
.chairs{
  display: flex;
  padding:50px 15px 10px 15px;
  background: white;
  justify-content: space-between;
  .single-chair{
    width: 30%;
  }
}
</style>
